var t = getApp();

Component({
    options: {
        addGlobalClass: !0
    },
    properties: {
        path: {
            value: "adDetails",
            type: String
        },
        details: {
            value: {},
            type: Object
        }
    },
    data: {},
    methods: {
        sendLike: function() {
            var e = this, i = this.data.details, a = i.id, s = t.getNetAddresss("plugin.new-media-advertising.frontend.media-advertisingt.like");
            t._getNetWork({
                url: s,
                data: {
                    advertisingt_id: a
                },
                success: function(a) {
                    var s = a.data;
                    if (1 != s.result) return t.tips(s.msg);
                    var r = i.is_like, d = r ? i.like_count - 1 : i.like_count + 1;
                    e.setData({
                        "details.is_like": !r,
                        "details.like_count": d
                    }), e.triggerEvent("like", {
                        is_like: r,
                        like_count: d
                    }), 1 == s.data.is_reward && e.triggerEvent("reward", s.data);
                }
            });
        },
        sendFavorites: function() {
            var e = this, i = this.data.details, a = i.id, s = t.getNetAddresss("plugin.new-media-advertising.frontend.media-advertisingt.favorites");
            t._getNetWork({
                url: s,
                data: {
                    advertisingt_id: a
                },
                success: function(a) {
                    var s = a.data;
                    if (1 != s.result) return t.tips(s.msg);
                    var r = i.is_favorites, d = r ? i.favorites_count - 1 : i.favorites_count + 1;
                    e.setData({
                        "details.is_favorites": !r,
                        "details.favorites_count": d
                    }), e.triggerEvent("favorites", {
                        is_favorites: r,
                        favorites_count: d
                    }), 1 == s.data.is_reward && e.triggerEvent("reward", s.data);
                }
            });
        },
        addShareRecord: function() {
            var e = t.getNetAddresss("plugin.new-media-advertising.frontend.media-advertisingt.forward");
            t._getNetWork({
                url: e,
                data: {
                    advertisingt_id: this.data.details.id
                },
                success: function(t) {}
            });
        },
        handCommentClick: function() {
            this.triggerEvent("commentClick");
        }
    }
});